import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

///Flexible 组件可以控制 Row、Column、Flex 的子控件占满父组件，比如，Row 中有3个子组件，两边的宽是100，中间的占满剩余的空间，
class SpacerWidget extends StatelessWidget {
  SpacerWidget({Key ?key, @required this.text}) : super(key: key);
  final String? text;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(text??""),
        ),
        body: Column(
          children: [
            Row(
              children: <Widget>[
                Container(width: 100,height: 50,color: Colors.green,),
                Spacer(flex: 2,),
                Container(width: 100,height: 50,color: Colors.blue,),
                Spacer(),
                Container(width: 100,height: 50,color: Colors.red,),
              ],
            ),

            SizedBox(
              height: 20,
            ),

          ],
        ));
  }
}
